import React from 'react'
import PropTypes from 'prop-types'
import { View, Text } from 'react-native'

export default class EveFatherDetail extends React.Component {
  static propTypes = {
    pInfo: PropTypes.object
  }

  static defaultProps = {
    pInfo: {}
  }

  _renderItem = item => {
    let {
      name,
      bed_no,
      sex,
      age,
      allergy,
      gradeName,
      inhosp_no,
      days,
      charge_type
    } = item
    return (
      <View
        style={{
          width: screenWidth,
          height: 100,
          borderBottomColor: '#efefef',
          borderBottomWidth: 1,
          backgroundColor: 'white'
        }}
      >
        <View
          style={{
            width: screenWidth,
            height: 40,
            paddingLeft: 16,
            paddingRight: 16,
            alignItems: 'center',
            flexDirection: 'row',
            justifyContent: 'space-between'
          }}
        >
          <Text style={{ fontSize: 16 }}>{name}</Text>
          <Text>{bed_no}</Text>
        </View>

        <View
          style={{
            width: screenWidth,
            height: 30,
            paddingLeft: 16,
            paddingRight: 16,
            alignItems: 'center',
            flexDirection: 'row',
            justifyContent: 'space-between'
          }}
        >
          <Text>
            {sex == 1 ? '男' : '女'}/{age}
          </Text>
          <Text>{inhosp_no}</Text>
          <Text>{days}</Text>
          <Text>{charge_type}</Text>
        </View>

        <View
          style={{
            width: screenWidth,
            height: 30,
            paddingLeft: 16,
            paddingRight: 16,
            alignItems: 'center',
            flexDirection: 'row'
          }}
        >
          <Text style={{ width: 80, color: 'green' }}>{gradeName}</Text>
          <Text style={{ color: 'red' }}>{allergy}</Text>
        </View>
      </View>
    )
  }

  render() {
    return (
      <View style={{ flex: 1 }}>
        {this._renderItem(this.props.pInfo)}
        {React.Children.only(this.props.children)}
      </View>
    )
  }
}
